package sicau.carManager.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import sicau.carManager.entity.BlackList;
import sicau.carManager.mapper.BlackListMapper;
import sicau.carManager.service.BlackListService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ITcz
 * @since 2021-02-05
 */
@Service
public class BlackListServiceImpl extends ServiceImpl<BlackListMapper, BlackList> implements BlackListService {

    @Autowired
    BlackListMapper blackMapper;

    @Override
    public int removeByLicensePlate(String licensePlate, String campus) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("license_plate_number", licensePlate);
        queryWrapper.eq("campus", campus);
        return blackMapper.delete(queryWrapper);
    }

    @Override
    public List<BlackList> getList(String campus) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("campus", campus);
        List<BlackList> list =  blackMapper.selectList(queryWrapper);

        if (list == null) {
            return null;
        }
        return list;
    }


}
